<template>
    <div class="main">
     <el-card class="card" shadow="never">
      <div slot="header">
        注册用户列表
      </div>
      <el-table

        :data="userList"
        border
        style="width: 100%"
      >
        <el-table-column type="index" label="序号" fixed="left" />
        <el-table-column
          align="center"
          prop="username"
          label="用户名"
          width="200"
        />
        <el-table-column
          align="center"
          prop="username"
          label="头像"
          width="200"
        >
          <template slot-scope="scope">
            <el-avatar style="width:60px;height:60px" size="small" :src=" scope.row.icon" />
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="nickname"
          label="昵称"
          width="150"
        />
        <el-table-column
          align="center"
          prop="realname"
          label="真实姓名"
          width="200"
        />
        <el-table-column
          align="center"
          prop="sex"
          label="性别"
          width="200"
        />
        <el-table-column
          align="center"
          prop="phone"
          label="电话"
          width="200"
        />
        <el-table-column
          align="center"
          prop="email"
          label="邮箱"
          width="200"
        />
        <el-table-column
          align="center"
          prop="birthday"
          label="生日"
          width="200"
        />
        <el-table-column
          align="center"
          prop="createTime"
          label="注册时间"
        />
      </el-table>

      <el-pagination
        :current-page="page.currentPage"
        :page-sizes="page.pageSizes"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>
    </div>
</template>

<script>
import{ getUser} from "@/api/userinfo"
import mixin from "@/minx/index";

export default {
    props: {

    },
    mixins: [mixin],
    data() {
        return {
          userList:[],

        };
    },
    computed: {

    },
    created() {
      this.init()

    },
    mounted() {

    },
    watch: {

    },
    methods: {
     async init(){
       this.userList=( await getUser( this.page.currentPage,
          this.page.size,)).data.rows
      this.page.total=( await getUser( this.page.currentPage,
          this.page.size,)).data.total

      },
      handleSizeChange(val) {
            this.page.size = val
            this.page.currentPage = 1
            this.init()
        },
        handleCurrentChange(val) {
            this.page.currentPage = val
            this.init()
        }
    },
    components: {

    },
};
</script>

<style lang="scss" scoped>
.main{
  background-color: #f0f2f5;
}
.card{
  width: 90%;
  margin: 0 auto;
  margin-top: 30px;
}
</style>
